package com.chezhujie.www.utils;

/**
 * Created by 汤伟杰 on 2017/7/11.
 */
public class MonUtil {
    /**
     * 月减
     * @param year
     * @param month
     * @param subtract
     */
    public static String monSubtract(int year, int month,int subtract) {

        int cmon;
        cmon = month-subtract;
        while(cmon<=0){
            cmon = 12+cmon;
            year = year-1;
        }
        if(10>cmon){
            return year+"-0"+cmon;
        }else{
            return year+"-"+cmon;
        }
    }
    public static String monSubtract2(int year, int month,int subtract) {

        int cmon;
        cmon = month-subtract;
        while(cmon<=0){
            cmon = 12+cmon;
            year = year-1;
        }
        return year+"-"+cmon;

    }
}
